﻿using System.Collections.Generic;
using System.Web.Mvc;
using Journal.Common.Helpers.HtmlControls;

namespace Journal.Common.Objects.Column
{
    public class LinkColumn : IBaseColumn
    {
        public LinkColumn(string value)
        {
            Value = value; 
        }

        public LinkColumn(string url, string value) : this(value)
        {
            Url = url;
            Value = value;
        }

        public LinkColumn(string url, string value, object attributes) : this(url, value)
        {
            Attributes = attributes;
        }

        public LinkColumn(string value, object attributes) : this(value)
        {
            Attributes = attributes;
        }

        public MvcHtmlString Render()
        {
            return Attributes != null ? TableControl.LinkColumn(Url, Value, Attributes) : TableControl.LinkColumn(Url, Value);
        }

        public string Url { get; set; }

        public string Value { get; set; }

        public bool HasSeparator { get; set; }

        public object Attributes { get; set; }

        public IDictionary<string, string> DataParams { get; set; }
    }
}